home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / SCRIPTZ / OMEN.ZIP / Addon.faq next >
Text File  |  1996-09-08  |  10KB  |  243 lines

  1. mirc addon faq .04 - concept by [x|x] and webba
  2. -----------------------------------------------------------------------------
  3. re: Now before you say blah blah this sucks here me out.
  4.     Read it determine its usefullness and use it or toss it.
  5. -----------------------------------------------------------------------------
  6.  
  7. Note to scripters:
  8. In order to add compatibility for addons in your script you need:
  9.  
  10. 1. %VER variable containg your scripts version
  11. 2. An /ADDON directory off of your main MIRC directory
  12. 3. Install the alias /SLOAD below
  13. load {
  14.   if (%ver == $null) {
  15.     echo 4 $active This is a non-compliant script, load failed.
  16.     halt
  17.   }
  18.   elseif (( $right(5,$1) == .mirc ) || ( $right(4,$1) == .mir )) {
  19.     play -c $me $mircdir $+ addon\ $+ $1 0
  20.     goto end
  21.   }
  22.   else /load $1 $2
  23.   }
  24.   else {
  25.     echo 4 $active Unsupported extension, load failed.
  26.   }
  27.   :end
  28. }
  29.  
  30. Thats IT! Do those 3 things and all your scripts will be compatible
  31. with addons.
  32.  
  33.  
  34. Questions and Answers:
  35.  
  36. Q: What is this MIRC ADDON STUFF?
  37.  
  38. A:
  39. This 'standard' allows mirc scripters and users use addon files like ircii
  40. and many clients allow you to do. Type /load whatever.mirc and boom you have
  41. an extra something to any script. This CAN be abused so i suggest you LOOK
  42. before you /load ANY .mirc file. With this 'standard' we can also /unload
  43. the aliases and sections the author of the .mirc added to your ini's.
  44.  
  45. Q: Why do you suppose we want to /load these .mirc's instead of using scripts?
  46.  
  47. A:
  48. Well the main point of mirc is for ppl to SCRIPT their own main scripts.
  49. Also there are MANY real bad scripting jobs out there. So this allows you
  50. to have the extras other may have thought of without RIPPING to your own script.
  51. Ripping is running rampant in mirc scripts. But nonetheless soemtimes needed
  52. for example. This 'standard' allows you to TEST someones addon and if you dont
  53. like it /unload. WITHOUT MAKING MAJOR INI CHANGES. Thats the key point.
  54. I have about 100+ dirs of mirc scripts on my hd. Just from testing and looking
  55. at them. enough said?
  56.  
  57. Q: Why do YOU propose this (question directed towards xix and webba for the concept)
  58.  
  59. A: Personally if i was new to mirc i would want something like this so i
  60. would not be confused or overwhelmed by mirc in general. Mirc is much more powerful
  61. now and new ppl have a hard time finding something that suits them.
  62. This does not abolish scripts it just lets us all as mirc users enjoy the fruits
  63. of someone elses labor. I would have used this concept if ANYONE else had thought
  64. of it because im sure others have but not implemented on a wide scale. So with
  65. that in mind make the decision yourself. :P
  66.  
  67. Q: How do i add support for addons to my ini/script?
  68.  
  69. A: Several ways have been tried and tested. I will show a few below. It can be
  70. simple alias or a multilined if alias. You choose what suits you best.
  71. Also NOTE that there is already a /LOAD command in mirc and this command overrides
  72. the default /load. One of these below ALLOWS both internal and addon LOADING.
  73.  
  74. THESE WOULD GO IN YOUR ALIAS SECTION:
  75.  
  76. Simple method(no error checking or internal load support)
  77.  
  78. load { play -c $me $mircdir $+ *1 | :end }
  79.  
  80. Advanced method(error checking and internal load support)
  81.  
  82. load {
  83.   if (%ver == $null) {
  84.     echo 4 $active This is a non-compliant script, load failed.
  85.     halt
  86.   }
  87.   elseif (( $right(5,$1) == .mirc ) || ( $right(4,$1) == .mir )) {
  88.     play -c $me $mircdir $+ addon\ $+ $1 0
  89.     goto end
  90.   }
  91.   elseif ($right(4,$2) == .ini) {
  92.     /load $1 $2
  93.   }
  94.   else {
  95.     echo 4 $active Unsupported extension, load failed.
  96.   }
  97.   :end
  98. }
  99.  
  100. Q: Ok how about the /unload part?
  101.  
  102. A: The /unload would be written IN THE ADDON itself you dont have to add support
  103. for it because a proper addon will have an /unload command and notify you of the
  104. exact syntax.
  105.  
  106. Q: Any other special conditions some addons MAY need?
  107.  
  108. A: Debate this all you like but here it is  :P
  109. We propose all scripts carry a %VER variable that stores the version reply.
  110. If that is not suitable thats ok im sure as people make scripts the will do
  111. as they like. BUT note this: if you add %VER support the authors of the
  112. addons will be able to append themselves to your version reply.
  113. This has benefits and drawbacks. Out of respect to the author of the addon
  114. you should allow them to append to your version reply thus giving them credit
  115. of some sort. This also lets others see that you have certain addons they may
  116. be looking for. And the politics of irc dictate addons are just plain cool.
  117. Haha. The drawbacks can be poor coded addons appends to your version reply
  118. a long drawn out plain idiotic reply. I propose you allow %VER but check the addon
  119. before /loading to make sure the author didnt do somethign stupid.
  120.  
  121. HERE IS AN EXAMPLE OF A VARIABLE DRIVEN VERSION REPLY
  122. THIS WOULD GO IN YOUR COMMANDS SECTION:
  123. (please add FLOOD protection in this alias to your liking)
  124.  
  125. 1:VERSION {
  126.   raw -r NOTICE $nick :VERSION %ver $+ 
  127. }
  128.  
  129.  
  130.  
  131. Q: What about other remote commands such as raw and popups?
  132.  
  133. A: This CAN be done very easily. With $readini and /writeini. Also
  134. mirc allows you to $dde it to get the main ini name so you can look in that
  135. ini for the raw= etc. This is not hard to figure out yet a bit tasking to
  136. to complete. Ill show a breif example of adding a line to the users raw ini.
  137.  
  138. TO ADDON AND REMOVE TO RAW EVENTS (as an example)
  139.  
  140. THE ADDING PART:
  141. set %raw $readini $dde mirc inifile "" Files raw
  142. save -r %raw $+ .bak
  143. %tmp = $lines(%raw) - 2
  144. writeini %raw Raw r $+ %tmp $+ =391:* { if $parm2 == $server { %lag = $ctime - %lag | goto end } | %slag = $ctime - %slag | echo %h $active %b $chr(91) $+  $+ $parm2 $+  $+ $chr(93) $+ : %slag seconds | :end }
  145.  
  146. THE REMOVAL:
  147. remove %raw
  148. load -r %raw $+ .bak
  149.  
  150. Thx to El_Barto and webba for some more great ideas here.
  151.  
  152. Q: How the heck do i make an addon?
  153.  
  154. A: Well the addon idea is based on the new /alias command that khaled so
  155. kindly gave us with mirc 4.5?+
  156. You can define new aliases by doing /alias <aliasname> <alias commands here>
  157. Now keep in mind the /load command is PLAYING the addon as a commands file.
  158. So a file with say:
  159.           alias cls { clear }
  160. Would be played as a command and thus ADDING that alias to your alias ini.
  161. Also by playing the addon as a command authors can echo that it is loading
  162. and check for %ver support etc.
  163. This is all fine and dandy but if youll notice some other lil tweaking is
  164. needed to make a successful addon. The way mirc is now it interperts all the
  165. evaluators immediatly. Like if you add an alias like:
  166.     alias test { say $1 was a test }
  167. Mirc will add to your alias ini:
  168. alias???=test say was a test
  169. Notice the $1 is not in there! Well with $chr(?) you can work around this
  170. very easily. :P
  171.  
  172. I will show you an example from webba's wkick.mirc addon:
  173.  
  174. echo 6 $active <-WK-> Now loading WKiCKS.mirc...
  175. /alias wk1 me looks at $chr(36) $+ 1 And Shake's His Head... $chr(124) say YOU'RE A KID, THIS DON'T LOOK LIKE #DUMBKIDS TO ME!@ $chr(124) kick $chr(35) $chr(36) $+ 1 WKiCKS)( KiDDy KiCK 
  176. /alias unloadwk alias wk1 $chr(124) alias unloadwk $chr(124) echo 6 <-WK-> WKiCKS Unloaded succesfully.
  177. echo 6 $active <-WK-> WKiCKS Loaded SUCCESSFULLY, to unload type /unloadwk.
  178.  
  179. Very simply put everything you want to do CAN be done.
  180.  
  181. Q: This /alias command how do we delete the aliases we add to our addons?
  182.  
  183. A: Well as an addon author if you do an alias as i mentioned before:
  184. alias cls { clear }
  185. It is now in the alias ini. To remove simply do:
  186. alias cls
  187. And that would remove that particular alias.
  188. So when writing and UNLOAD alias
  189. it might look as so:
  190. /unloadtest alias cls $chr(124) alias test
  191.  
  192. Let me explain a lil simpler - $chr(124) is the | character since you cant
  193. play the | as a command it has to be added as $chr(124)
  194. Also that unloadtest alias did two things
  195. deleted the alias cls
  196. and deleted the alias test
  197.  
  198.  
  199. Q: In my addon how do i check for and add to %ver if it exists?
  200.  
  201. A: Ill show some small examples of how to add to and error check for %VER.
  202.  
  203. if %ver == $null { play stop }
  204. The above obviously says if %ver does not exist dont load the addon.
  205.  
  206. if blah.mirc !isin %ver { %ver = %ver $chr(43) blah.mirc by bleh }
  207. The above says if blah.mirc is not in the %ver reply go ahead and append to
  208. the %ver version reply variable.
  209.  
  210. Non compliant scripts get this from my addons:
  211. if %ver == $null { echo 4 Sorry +geek+ dont like nonaddon compliant scripts...GET the addon.faQ and add support! Get the faQ at http://www.geocities.com/TimesSquare/3873/irc.html | play stop }
  212.  
  213. Q: What are some of the limitations the addons and mirc have?
  214.  
  215. A: Well good question. Heres what i can tell you so far.
  216. You have to replace all internal evaluators and strings with $chr(#)
  217. Like even $active for example has to be written in the addon as $chr(36) $+ active
  218. And in some cases (depending on where the evaluator fits) even $+
  219. has to be replaced as $chr(36) $+ +
  220. I think you get the idea. If something is not working and you cant figure out
  221. why $chr(#) is probably the answer.
  222.  
  223.  
  224. Q: What other things can i add to my script to make it nice?
  225.  
  226. A: A lotta ircii scripts have ascii's of there logo. They are nice looking
  227. way to announce your script is loaded and a good way to include credits
  228. and help instructions. A WELL WRITTEN addon is what ppl want. Include help
  229. and the UNLOAD MUST UNDO ALL CHANGES DONE or its useless ppl wont like it
  230. or load it again. This also revives mircs younger days when ppl were pumped
  231. about just irc in general. Stupid lil fun addons are what i am looking for
  232. there isnt that many around. Of course war addons are always NIZE too. ;)
  233. Possibly a dalnet/undernet addon. An addon to have all the eggdrop commands
  234. and kick addons are fun. Theres a number of possibilities there is no limit.
  235.  
  236. I hope you take the time to check out the usefullness of addons and
  237. making mirc a more friendly and more powerful irc environment.
  238.  
  239.                                         - peace [x|x] & webba
  240.  
  241. You can always find the latest of this faQ and addons at:
  242.            http://www.geocities.com/TimesSquare/3873/irc.html
  243.